package cn.swu.lyx.homework1

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView

class MilkTeaListActivity : AppCompatActivity() {

    val milkTeaList= arrayListOf<MilkTea>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_list)
        //初始化数据
        initMilkTea()
        val recyclerView=findViewById<RecyclerView>(R.id.recyclerView)
        //语法糖
        recyclerView.layoutManager=LinearLayoutManager(this)
        recyclerView.adapter=MilkTeaAdapter(milkTeaList)

    }
    private fun initMilkTea(){
        repeat(2){
            milkTeaList.add(
                MilkTea().apply {
                    name="芝士霉霉2.0"
                    description=
                        "草莓多肉×茉莉花茶×奶盖。就近产区鲜采草莓,每杯现捣果肉,果茸丝丝;茉莉花茶与新鲜草莓搅打成沙冰,莓香四溢茶香点缀。伴随浓郁芝士奶盖,每一口都酸甜满足。"
                    image=R.drawable.zsmm2
                }
            )
            milkTeaList.add(
                MilkTea().apply {
                    name="生椰抹茶麻薯"
                    description=
                        "麻薯小丸子x抹茶x生椰乳。小丸子与麻薯的糯糯组合相得益彰,软糯间又多了些充满嚼劲的惊喜,创新生椰乳 抹茶汤底,清爽鲜香,舌底回甘。"
                    image=R.drawable.syms
                }
            )
            milkTeaList.add(
                MilkTea().apply {
                    name="布蕾脆脆奶芙"
                    description=
                        "布蕾×奶油顶×坚果碎×珍珠×奶茶。人气饮品，众望回归，咔滋一下，脆脆有声！"
                    image=R.drawable.blccnf
                }
            )
            milkTeaList.add(
                MilkTea().apply {
                    name="百香果双响炮"
                    description=
                        "茉莉花茶×百香果×青橘×椰果×珍珠。满满百香果，搭配珍珠和椰果，口感兼具 Q 弹和软糯。满口酸甜直击味蕾。"
                    image=R.drawable.bxgsxp
                }
            )
            milkTeaList.add(
                MilkTea().apply {
                    name="杨枝甘露"
                    description=
                        "芒果 x 西柚粒 x 西米×多肉×椰奶×茉莉花茶。古茗爆款产品！甄选当季鲜芒果，增加西柚果粒，搭配西米多肉。沿用茉莉茶底，融合椰奶，一口绵密沙冰，多重风味在嘴里层层释放。"
                    image=R.drawable.yzgl
                }
            )
            milkTeaList.add(
                MilkTea().apply {
                    name="嫩仙草满福"
                    description=
                        "仙草×珍珠×青稞 X 红豆 X 花生碎×葡萄干。古法熬制嫩仙草，兼具爽滑口感和草本清香，一“碗”6种料，多层口感，超过瘾～"
                    image=R.drawable.nxcmf
                }
            )
        }
    }
}